package com.hundredapp.oa.repository;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.hundredapp.oa.dao.GenericDao;
import com.hundredapp.oa.domain.OaRole;
import com.hundredapp.oa.domain.OaSubject;

@Repository
public class SubjectManagerImpl implements SubjectManager{

	@Autowired
	private GenericDao<OaSubject, Integer> subjectDao;

	@Override
	public List<OaSubject> findAll(String condition) {
		return subjectDao.find(condition);
	}
	
	public void setSubjectDao(GenericDao<OaSubject, Integer> subjectDao) {
		this.subjectDao = subjectDao;
	}

	@Override
	public OaSubject findById(Integer id) {
		return subjectDao.findById(id);
	}

	@Override
	public void add(OaSubject subject) {
		subjectDao.saveOrUpdate(subject);
		
	}

	@Override
	public void delete(Integer subjectid) {
		subjectDao.remove(subjectDao.findById(subjectid));
	}

	@Override
	public List<OaSubject> find(String condition, int start, int limit) {
		return subjectDao.find(condition, start, limit);
	}


	@Override
	public int count(String condition) {
		return subjectDao.count(condition);
	}



	
	
	
}
